<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1,IE=9">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="LEUR DE CHINE">
    <meta name="keywords"
          content="china reds,china blues,cashmere,corduroy,little bag,tartans,tweeds,stars,stripes,linen,leather,tassel travel bag,tartan,accessories">
    <title>上药神象农业物联网监控系统</title>
    <!--[if lte IE 8]>
    <script>window.location.href = 'http://cdn.dmeng.net/upgrade-your-browser.html?referrer=' + location.href;</script>
    <![endif]-->
    <script type="text/javascript" src="${basePath}/pc/lib/respond/respond.src.js"></script>
    <link href="${basePath}/pc/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="${basePath}/pc/css/font-awesome.min.css" rel="stylesheet">
    <link href="${basePath}/pc/lib/iconfont/css/iconfont.css" rel="stylesheet">
    <link href="${basePath}/pc/css/main.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <script src="${basePath}/pc/lib/bootstrap/js/html5shiv.min.js"></script>
    <script src="${basePath}/pc/lib/bootstrap/js/respond.min.js"></script>
    <![endif]-->
    <style>
        .map a{color:#333;cursor: pointer;}
    </style>
</head>

<body>
<div class="wrp">
    <nav class="navbar navbar-inverse cm_nav">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                        aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="${basePath}/pc/user/main">
                    <img src="${basePath}/pc/img/logo_white.png" class="img-responsive">
                </a>
            </div>
            <div id="navbar" class="collapse navbar-collapse">
                <ul class="nav navbar-nav mnav">
                    <li class="active"><a href="${basePath}/pc/user/main">监控数据</a></li>
                    <li><a href="${basePath}/function/pc/farmwork">农事记录</a></li>
                </ul>
                <ul class="navbar-nav navbar-right smenu">
                    <li class="wl_fnt"><a><i class="iconfont icon-account"></i>欢迎：${username}</a></li>
                    <li class="ext_lnk"><a href="${basePath}/logout"><i class="iconfont icon-exit1"></i>退出</a></li>
                </ul>

            </div><!--/.nav-collapse -->
        </div>
    </nav>

    <div class="pgc">
        <div class="container">
            <div class="cls">
                <div class="cls_cnt">
                    <dl class="mtt">
                        <dt class="tit"><img src="${basePath}/pc/img/mp_lg.png" height="30" class="mp_lg">上药神象物联网监控系统分布图
                        </dt>
                        <dd>点击设备编号查看数据</dd>
                    </dl>

                    <div class="ept_menu">
                        <ul id="accordion" class="accordion">
                            <li>
                                <div class="link"><span class="icn icn_01"></span>传感器组<i
                                        class="iconfont icon-right arw_r"></i></div>
                                <ul class="submenu">
                                    <li class="srsr_num"></li>
                                </ul>
                                <div class="lne"></div>
                            </li>
                            <li>
                                <div class="link">
                                    <span class="icn icn_02"></span>水体EC
                                    <i class="iconfont icon-right arw_r"></i>
                                </div>
                                <ul class="submenu">
                                    <li class="ec_num"></li>
                                </ul>
                                <div class="lne"></div>
                            </li>
                            <li>
                                <div class="link">
                                    <span class="icn icn_03"></span>枪机
                                    <i class="iconfont icon-right arw_r"></i>
                                </div>
                                <ul class="submenu">
                                    <li class="qj_num"></li>
                                </ul>
                                <div class="lne"></div>
                            </li>
                            <li>
                                <div class="link">
                                    <span class="icn icn_04"></span>球机
                                    <i class="iconfont icon-right arw_r"></i>
                                </div>
                                <ul class="submenu">
                                    <li class="uj_num"></li>
                                </ul>
                                <div class="lne"></div>
                            </li>

                        </ul>
                    </div><!--ept_menu end-->
                    <div class="map">
                        <div class="qj_lst"> </div>
                        <div class="uj_lst"></div>
                        <div class="ec_lst"></div>
                        <div class="snsr_lst"></div>
                        <img src="${basePath}/pc/img/map.gif" class="img-responsive"/>
                    </div><!--map end-->
                    <div class="cn_map">
                        <img src="${basePath}/pc/img/china_map.gif" class="img-responsive"/>
                    </div><!--cn_map end-->
                    <div class="clr-b"></div>
                </div><!--cls_cnt end-->
            </div><!--cls end-->
        </div>
    </div><!--pgc end-->
    <footer class="ftr">Copyright<span class="cpy">&copy;</span>2017 上海上药神象健康药业有限公司</footer>
</div>
<!--wrp end-->
<script src="${basePath}/pc/lib/jquery/jquery.min.js"></script>
<script src="${basePath}/pc/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="${basePath}/common/js/common.js"></script>
<script src="${basePath}/common/js/ajax.js"></script>
<script src="${basePath}/common/js/form.js"></script>
<script src="${basePath}/pc/js/custom.js"></script>
<script>
    function loadALlList(url,contain,indexName,mapContain,name,icon) {
        SyncGet(url,null,function (value) {
            if(value.code==0){
                contain.empty();
                mapContain.empty();
                for(var i=0;i<value.data.length;i++){
                    var containA=$("<a class='grey'></a>");
                    containA.text(value.data[i][indexName]);
                    containA.attr("id",value.data[i].id);
                    contain.append(containA);

                    var mapContainA=$("<a></a>");
                    mapContainA.attr("data-toggle","tooltip");
                    mapContainA.attr("title",value.data[i][name]);
                    mapContainA.attr("id",value.data[i].id);
                    mapContainA.css({left:value.data[i].leftValue+"%",top:value.data[i].topValue+"%"})
                    var span=$("<span></span>");
                    span.addClass("num grey").addClass(contain.attr("class"));
                    span.text(value.data[i][indexName]);
                    var iconI=$("<i class='iconfont'></i>");
                    iconI.addClass(icon);
                    mapContainA.append(span).append(iconI);
                    mapContain.append(mapContainA);
                }
            }else{
                alert(value.msg);
            }
        })
    }
    function loadUserList(url,contain,mapContain,location) {
        AsyncGet("${basePath}/pc/user/getUserRole",null,function (value) {
            AsyncGet(url,null,function (value) {
                if(value.code==0){
                    for(var i=0;i<value.data.length;i++){
                        var containA=contain.find("a[id='"+value.data[i].id+"']");
                        containA.removeClass("grey");
                        containA.attr("href",location+"?index="+containA.text()+"&id="+value.data[i].id);

                        var mapA= mapContain.find("a[id='"+value.data[i].id+"']");
                        mapA.attr("href",location+"?index="+mapA.find("span").text()+"&id="+value.data[i].id);
                        mapA.find("span").removeClass("grey");
                    }
                }else{
                    alert(value.msg);
                }
            })

            /*if(value.data.userType!=3){

            }else{
                contain.find("a").removeClass("grey");
                contain.find("a").each(function () {
                    $(this).attr("href",location+"?index="+$(this).text()+"&id="+$(this).attr("id"));
                });

                mapContain.find("a span").removeClass("grey");
                mapContain.find("a").each(function () {
                    $(this).attr("href",location+"?index="+$(this).find("span").text()+"&id="+$(this).attr("id"));
                });
            }*/
        })

    }

    $(function () {
        loadALlList("${basePath}/pc/sensor/getSensorGroupList",
            $(".srsr_num"),"sensorGroupIndex",$(".snsr_lst"),"sensorGroupName","icon-temperature1");
        loadALlList("${basePath}/pc/sensor/getECList",
            $(".ec_num"),"sensorGroupIndex",$(".ec_lst"),"sensorGroupName","icon-ec");
        loadALlList("${basePath}/pc/monitor/getQjMonitorList",
            $(".qj_num"),"probeIndex",$(".qj_lst"),"probeName","icon-Monitoring");
        loadALlList("${basePath}/pc/monitor/getUjMonitorList",
            $(".uj_num"),"probeIndex",$(".uj_lst"),"probeName","icon-jiankong");

        $('[data-toggle="tooltip"]').tooltip();

        loadUserList("${basePath}/pc/sensor/getUserSensorGroupList",
            $(".srsr_num"),$(".snsr_lst"),"${basePath}/function/pc/sensor");
        loadUserList("${basePath}/pc/sensor/getUserECList",
            $(".ec_num"),$(".ec_lst"),"${basePath}/function/pc/ec");
        loadUserList("${basePath}/pc/monitor/getUserQjMonitorList",
            $(".qj_num"),$(".qj_lst"),"${basePath}/function/pc/monitor");
        loadUserList("${basePath}/pc/monitor/getUserUjMonitorList",
            $(".uj_num"),$(".uj_lst"),"${basePath}/function/pc/monitor");

        new Accordion($('#accordion'), false);
    })

</script>
</body>
</html>
